package com.imooc.springcloud;

import org.springframework.boot.WebApplicationType;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

/**
 * @describte:服务消费者
 * @program:spring-cloud-demo
 * @author:zhengdp
 * @create:2021-09-30 00:47:08
 **/
@SpringBootApplication
@EnableDiscoveryClient
public class RibbonConsumerApplication {

    @LoadBalanced
    @Bean
    public RestTemplate register(){
        return new RestTemplate();
    }

    public static void main(String[] args) {
        new SpringApplicationBuilder(RibbonConsumerApplication.class)
                .web(WebApplicationType.SERVLET)
                .run(args);
    }
}
